using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using Microsoft.DesignerSupport;

namespace XMTAEditor
{
	public partial class MethodEditor : BaseEditor
	{
		public MethodEditor()
		{
			InitializeComponent();
			editorBrowsable.EnumType = typeof(EditorBrowsableState);
		}

		private MethodType meth;

		public MethodType Method
		{
			get { return meth; }
			set { meth = value; Fill();  }
		}

		protected override void Fill()
		{
			checkBoxList1.Items[0].State = BindUtil.ToCheck(meth.Supported);
			editorBrowsable.EnumVal = BindUtil.ToText(meth.EditorBrowsable);
			parameters.Text = BindUtil.ToText(meth.Parameters);
			checkBoxList1.Refresh();
		}

		public override void Save()
		{
			changed = false;
			meth.Supported = BindUtil.FromCheck(checkBoxList1.Items[0].State);
			meth.EditorBrowsable = BindUtil.ToVar(editorBrowsable.EnumVal);
			meth.Parameters = BindUtil.ToVar(parameters.Text);
		}

		private void MethodEditor_Load(object sender, EventArgs e)
		{

		}

		private void description_TextChanged(object sender, EventArgs e)
		{
			changed = true;
		}
	}
}
